package com.project.util.codingUtils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Created by 卢泓佚  414814103@qq.com on 2021/9/27
 * alter by lyl
 */
public class StringUtil {
    //微信小程序id
    public static final String APP_ID = "wx04a9b1f15068314b";
    //微信小程序密钥
    public static final String APP_SECRET = "6a4789a287502a3fa53eb8954f29694d";
    //文件上传格式后缀
    public static final String UPLOAD_FORMAT[] = {"image/jpeg", "image/png", "image/gif", "image/bmp"};
    //文件上传目录
    // public static final String IMG_PATH="/home/img/";
    public static final String IMG_PATH = "d:/img2/";

    /**
     * 如果str存在返回真，否则假
     *
     * @param strings 取and
     * @return
     */
    public static boolean StringVerify(String... strings) {
        boolean bl = true;
        for (String str : strings) {
            if (null == str || "".equals(str)) {
                bl = false;
                break;
            }
        }
        return bl;
    }

    public static String getDateYYYYMMDDSS() {
        LocalDateTime dt = LocalDateTime.now(); // 当前日期和时间 获取到的总是以当前默认时区返回的
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return dtf.format(dt);
    }

    public static String getDateYYYYMMDD() {
        LocalDateTime dt = LocalDateTime.now(); // 当前日期和时间 获取到的总是以当前默认时区返回的
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return dtf.format(dt);
    }

    /**
     * 验证字符串是否为null
     *
     * @return
     */
    public static boolean verify(String str) {
        if (null == str || str.length() <= 0 || str.trim().equals("")) {
            return false;
        }
        return true;
    }
}
